package com.taomeishu.mailcrazy.checkers;

import com.taomeishu.mailcrazy.AbstractMailExistChecker;
import com.taomeishu.mailcrazy.checkers.gmail.GmailResultParser;
import com.taomeishu.mailcrazy.parser.ResultParser;

public class GmailMailExistChecker extends AbstractMailExistChecker {

	private GmailResultParser gmailResultParser = new GmailResultParser();
	
	@Override
	protected String makeRequestUrl(String username, String domainName) {
		return "https://accounts.google.com/InputValidator?resource=signup&service=mail";
	}

	@Override
	protected String getReferer() {
		return "https://accounts.google.com/SignUp?service=mail&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&ltmpl=default";
	}

	@Override
	protected boolean usePostMethod() {
		return true;
	}

	@Override
	protected String getContentType() {
		return "application/json; charset=UTF-8";
	}

	@Override
	protected byte[] getPostData(String username, String domainName) {
		String s = "{\"input01\":{\"Input\":\"GmailAddress\",\"GmailAddress\":\""+ username +"\",\"FirstName\":\"\",\"LastName\":\"\"},\"Locale\":\"zh-CN\"}";
		return s.getBytes();
	}

	@Override
	protected ResultParser getResultParser() {
		return gmailResultParser;
	}

}
